3.1045 \(\int (a+i a \tan (e+f x))^2 (c-i c \tan (e+f x))^n \, dx\)

Optimal. Leaf size=64 \[ \frac{2 i a^2 (c-i c \tan (e+f x))^n}{f n}-\frac{i a^2 (c-i c \tan (e+f x))^{n+1}}{c f (n+1)} \]

[Out]

((2*I)*a^2*(c - I*c*Tan[e + f*x])^n)/(f*n) - (I*a^2*(c - I*c*Tan[e + f*x])^(1 + n))/(c*f*(1 + n))

________________________________________________________________________________________

Rubi [A]  time = 0.127287, antiderivative size = 64, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 3, integrand size = 31, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.097, Rules used = {3522, 3487, 43} \[ \frac{2 i a^2 (c-i c \tan (e+f x))^n}{f n}-\frac{i a^2 (c-i c \tan (e+f x))^{n+1}}{c f (n+1)} \]

Antiderivative was successfully verified.

[In]

Int[(a + I*a*Tan[e + f*x])^2*(c - I*c*Tan[e + f*x])^n,x]

[Out]

((2*I)*a^2*(c - I*c*Tan[e + f*x])^n)/(f*n) - (I*a^2*(c - I*c*Tan[e + f*x])^(1 + n))/(c*f*(1 + n))

Rule 3522

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((c_) + (d_.)*tan[(e_.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Di
st[a^m*c^m, Int[Sec[e + f*x]^(2*m)*(c + d*Tan[e + f*x])^(n - m), x], x] /; FreeQ[{a, b, c, d, e, f, n}, x] &&
EqQ[b*c + a*d, 0] && EqQ[a^2 + b^2, 0] && IntegerQ[m] &&  !(IGtQ[n, 0] && (LtQ[m, 0] || GtQ[m, n]))

Rule 3487

Int[sec[(e_.) + (f_.)*(x_)]^(m_)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Dist[1/(a^(m - 2)*b
*f), Subst[Int[(a - x)^(m/2 - 1)*(a + x)^(n + m/2 - 1), x], x, b*Tan[e + f*x]], x] /; FreeQ[{a, b, e, f, n}, x
] && EqQ[a^2 + b^2, 0] && IntegerQ[m/2]

Rule 43

Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int[ExpandIntegrand[(a + b*x)^m*(c + d
*x)^n, x], x] /; FreeQ[{a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && IGtQ[m, 0] && ( !IntegerQ[n] || (EqQ[c, 0]
&& LeQ[7*m + 4*n + 4, 0]) || LtQ[9*m + 5*(n + 1), 0] || GtQ[m + n + 2, 0])

Rubi steps

\begin{align*} \int (a+i a \tan (e+f x))^2 (c-i c \tan (e+f x))^n \, dx &=\left (a^2 c^2\right ) \int \sec ^4(e+f x) (c-i c \tan (e+f x))^{-2+n} \, dx\\ &=\frac{\left (i a^2\right ) \operatorname{Subst}\left (\int (c-x) (c+x)^{-1+n} \, dx,x,-i c \tan (e+f x)\right )}{c f}\\ &=\frac{\left (i a^2\right ) \operatorname{Subst}\left (\int \left (2 c (c+x)^{-1+n}-(c+x)^n\right ) \, dx,x,-i c \tan (e+f x)\right )}{c f}\\ &=\frac{2 i a^2 (c-i c \tan (e+f x))^n}{f n}-\frac{i a^2 (c-i c \tan (e+f x))^{1+n}}{c f (1+n)}\\ \end{align*}

Mathematica [A]  time = 2.46127, size = 72, normalized size = 1.12 \[ -\frac{a^2 (n \tan (e+f x)-i (n+2)) (c \sec (e+f x))^n \exp (n (-\log (c \sec (e+f x))+\log (c-i c \tan (e+f x))))}{f n (n+1)} \]

Antiderivative was successfully verified.

[In]

Integrate[(a + I*a*Tan[e + f*x])^2*(c - I*c*Tan[e + f*x])^n,x]

[Out]

-((a^2*E^(n*(-Log[c*Sec[e + f*x]] + Log[c - I*c*Tan[e + f*x]]))*(c*Sec[e + f*x])^n*((-I)*(2 + n) + n*Tan[e + f
*x]))/(f*n*(1 + n)))

________________________________________________________________________________________

Maple [A]  time = 0.278, size = 100, normalized size = 1.6 \begin{align*}{\frac{i{{\rm e}^{n\ln \left ( c-ic\tan \left ( fx+e \right ) \right ) }}{a}^{2}}{f \left ( 1+n \right ) }}+{\frac{2\,i{{\rm e}^{n\ln \left ( c-ic\tan \left ( fx+e \right ) \right ) }}{a}^{2}}{fn \left ( 1+n \right ) }}-{\frac{{a}^{2}\tan \left ( fx+e \right ){{\rm e}^{n\ln \left ( c-ic\tan \left ( fx+e \right ) \right ) }}}{f \left ( 1+n \right ) }} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+I*a*tan(f*x+e))^2*(c-I*c*tan(f*x+e))^n,x)

[Out]

I/f/(1+n)*exp(n*ln(c-I*c*tan(f*x+e)))*a^2+2*I/f/n/(1+n)*exp(n*ln(c-I*c*tan(f*x+e)))*a^2-a^2/f/(1+n)*tan(f*x+e)
*exp(n*ln(c-I*c*tan(f*x+e)))

________________________________________________________________________________________

Maxima [B]  time = 1.8301, size = 367, normalized size = 5.73 \begin{align*} \frac{2^{n + 1} a^{2} c^{n} \cos \left (n \arctan \left (\sin \left (2 \, f x + 2 \, e\right ), \cos \left (2 \, f x + 2 \, e\right ) + 1\right )\right ) - i \cdot 2^{n + 1} a^{2} c^{n} \sin \left (n \arctan \left (\sin \left (2 \, f x + 2 \, e\right ), \cos \left (2 \, f x + 2 \, e\right ) + 1\right )\right ) + 2 \,{\left (a^{2} c^{n} n + a^{2} c^{n}\right )} 2^{n} \cos \left (-2 \, f x + n \arctan \left (\sin \left (2 \, f x + 2 \, e\right ), \cos \left (2 \, f x + 2 \, e\right ) + 1\right ) - 2 \, e\right ) -{\left (2 i \, a^{2} c^{n} n + 2 i \, a^{2} c^{n}\right )} 2^{n} \sin \left (-2 \, f x + n \arctan \left (\sin \left (2 \, f x + 2 \, e\right ), \cos \left (2 \, f x + 2 \, e\right ) + 1\right ) - 2 \, e\right )}{{\left (-i \, n^{2} +{\left (-i \, n^{2} - i \, n\right )} \cos \left (2 \, f x + 2 \, e\right ) +{\left (n^{2} + n\right )} \sin \left (2 \, f x + 2 \, e\right ) - i \, n\right )}{\left (\cos \left (2 \, f x + 2 \, e\right )^{2} + \sin \left (2 \, f x + 2 \, e\right )^{2} + 2 \, \cos \left (2 \, f x + 2 \, e\right ) + 1\right )}^{\frac{1}{2} \, n} f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))^2*(c-I*c*tan(f*x+e))^n,x, algorithm="maxima")

[Out]

(2^(n + 1)*a^2*c^n*cos(n*arctan2(sin(2*f*x + 2*e), cos(2*f*x + 2*e) + 1)) - I*2^(n + 1)*a^2*c^n*sin(n*arctan2(
sin(2*f*x + 2*e), cos(2*f*x + 2*e) + 1)) + 2*(a^2*c^n*n + a^2*c^n)*2^n*cos(-2*f*x + n*arctan2(sin(2*f*x + 2*e)
, cos(2*f*x + 2*e) + 1) - 2*e) - (2*I*a^2*c^n*n + 2*I*a^2*c^n)*2^n*sin(-2*f*x + n*arctan2(sin(2*f*x + 2*e), co
s(2*f*x + 2*e) + 1) - 2*e))/((-I*n^2 + (-I*n^2 - I*n)*cos(2*f*x + 2*e) + (n^2 + n)*sin(2*f*x + 2*e) - I*n)*(co
s(2*f*x + 2*e)^2 + sin(2*f*x + 2*e)^2 + 2*cos(2*f*x + 2*e) + 1)^(1/2*n)*f)

________________________________________________________________________________________

Fricas [A]  time = 1.64454, size = 188, normalized size = 2.94 \begin{align*} \frac{{\left (2 i \, a^{2} +{\left (2 i \, a^{2} n + 2 i \, a^{2}\right )} e^{\left (2 i \, f x + 2 i \, e\right )}\right )} \left (\frac{2 \, c}{e^{\left (2 i \, f x + 2 i \, e\right )} + 1}\right )^{n}}{f n^{2} + f n +{\left (f n^{2} + f n\right )} e^{\left (2 i \, f x + 2 i \, e\right )}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))^2*(c-I*c*tan(f*x+e))^n,x, algorithm="fricas")

[Out]

(2*I*a^2 + (2*I*a^2*n + 2*I*a^2)*e^(2*I*f*x + 2*I*e))*(2*c/(e^(2*I*f*x + 2*I*e) + 1))^n/(f*n^2 + f*n + (f*n^2
+ f*n)*e^(2*I*f*x + 2*I*e))

________________________________________________________________________________________

Sympy [F(-2)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: AttributeError} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))**2*(c-I*c*tan(f*x+e))**n,x)

[Out]

Exception raised: AttributeError

________________________________________________________________________________________

Giac [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int{\left (i \, a \tan \left (f x + e\right ) + a\right )}^{2}{\left (-i \, c \tan \left (f x + e\right ) + c\right )}^{n}\,{d x} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))^2*(c-I*c*tan(f*x+e))^n,x, algorithm="giac")

[Out]

integrate((I*a*tan(f*x + e) + a)^2*(-I*c*tan(f*x + e) + c)^n, x)